<template>
	<div></div>
</template>
<script>
	import api from 'api/api.js';
	import Cookie from 'js-cookie';
	import {
		pageRules
	} from './pageRules';

	export default {
		name: 'root',
		data() {
			return {}
		},
		methods: {
			init() {
				// 获取cookie中的x-response
				let res = Cookie.get('x-response');
				if (res) {
					let resObj = JSON.parse(decodeURIComponent(res));
					console.log(resObj);
					Cookie.remove('x-response');
					console.log(`返回状态码${resObj.code}`);
					pageRules[resObj.code].call(this, resObj);
				} else {
					console.log('x-response不存在');
				}
			},
		},
		created() {
			console.log('进入begin');
			this.init();
		},
	}
</script>
